<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //创建构造函数
        function Parent(name, age, sex){
            //实例对象
            this.name = name;
            this.age = age;
            this.sex = sex;
        }
        //构造函数通过protype访问原型对象showMe方法：
        Parent.prototype.showMe = function(){
            console.log('我是'+this.name+'我的年龄是'+this.age+'我的性别是'+this.sex); 
        }
        //调用
        var son1 = new Parent('张三', 20, '男');
        son1.showMe();
    </script>
</body>

</html>